/**
 * Created by zxh on 2016/12/12.
 */
import React from 'react';
import {} from 'antd';

import ImageView from '../../components/ImageView';  //查看图片组件
import Logger from '../../utils/Logger';

const logger = Logger.getLogger('HrefElementConverter');

class HrefElementConverter {

  convert(option) {
    const {getFieldProps, field, fieldOptions, wrapper, obj} = option;
    switch (field.dataType) {
      case 'imageView':
        return this.transformImgView(option);
    }
  }

  /**
    * 将schema中的一列转换为下拉框
    *
    * @param field
    */
  transformImgView(option) {
    const {getFieldProps, field, fieldOptions, obj, wrapper} = option;
    logger.debug('transform field %o to datetime input', field);
    return wrapper((
      <ImageView images={field.images}/>
    ), field);
  }

}

export default HrefElementConverter;
